//  您好，谢谢您参考我的项目，如果有问题请移步
//  https://github.com/manofit/GJLineChartView

//
//  ViewController.m
//  GJLineChartView
//
//  Created by gaojun on 2017/9/31.
//  Copyright © 2017年 GJ. All rights reserved.
//

#import "ViewController.h"
#import "GJLineChartView.h"
#import "GJChartDrawView.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    //折线图
//    NSArray *XTitleArray = [NSArray arrayWithObjects:@"00:00",@"00:02",@"00:05",@"00:08",@"00:11",@"00:14",@"00:17",@"00:20",@"00:23",@"00:26",@"00:29",@"00:32",@"00:35",@"00:38",@"00:41",@"00:44",@"00:47",@"00:50",@"00:53",@"00:56",@"00:59",@"01:02",@"01:05",@"01:08",@"01:11",@"01:14",@"01:17",@"01:20",@"01:23",@"01:26",@"01:29",@"01:32",@"01:35",@"01:38",@"01:41",@"01:44",@"01:47",@"01:50",@"01:53",@"01:56",@"01:59",@"02:02",@"02:05",@"02:08",@"02:11",@"02:14",@"02:17",@"02:20",@"02:23",@"02:26",@"02:29",@"02:32",@"02:35",@"02:38",@"02:41",@"02:44",@"02:47",@"02:50",@"02:53",@"02:56",@"02:59",@"03:02",@"03:05",@"03:08",@"03:11",@"03:14",@"03:17",@"03:20",@"03:23",@"03:26",@"03:29",@"03:32",@"03:35",@"03:38",@"03:41",@"03:44",@"03:47",@"03:50",@"03:53",@"03:56",@"03:59",@"04:02",@"04:05",@"04:08",@"04:11",@"04:14",@"04:17",@"04:20",@"04:23",@"04:26",@"04:29",@"04:32",@"04:35",@"04:38",@"04:41",@"04:44",@"04:47",@"04:50",@"04:53",@"04:56",@"04:59",@"05:02",@"05:05",@"05:08",@"05:11",@"05:14",@"05:17",@"05:20",@"05:23",@"05:26",@"05:29",@"05:32",@"05:35",@"05:38",@"05:41",@"05:44",@"05:47",@"05:50",@"05:53",@"05:56",@"05:59",@"06:02",@"06:05",@"06:08",@"06:11",@"06:14",@"06:17",@"06:20",@"06:23",@"06:26",@"06:29",@"06:32",@"06:35",@"06:38",@"06:41",@"06:44",@"06:47",@"06:50",@"06:53",@"06:56",@"06:59",@"07:02",@"07:05",@"07:08",@"07:11",@"07:14",@"07:17",@"07:20",@"07:23",@"07:26",@"07:29",@"07:32",@"07:35",@"07:38",@"07:41",@"07:44",@"07:47",@"07:50",@"07:54",@"07:57",@"08:00",@"08:03",@"08:06",@"08:09",@"08:12",@"08:15",@"08:18",@"08:21",@"08:24",@"08:27",@"08:30",@"08:33",@"08:36",@"08:39",@"08:42",@"08:45",@"08:48",@"08:51",@"08:54",@"08:57",@"09:00",@"09:03",@"09:06",@"09:09",@"09:12",@"09:15",@"09:18",@"09:21",@"09:24",@"09:27",@"09:30",@"09:33",@"09:36",@"09:39",@"09:42",@"09:45",@"09:48",@"09:51",@"09:54",@"09:57",@"10:00",@"10:03",@"10:06",@"10:09",@"10:12",@"10:15",@"10:18",@"10:21",@"10:24",@"10:27",@"10:30",@"10:33",@"10:36",@"10:39",@"10:42",@"10:45",@"10:48",@"10:51",@"10:54",@"10:57",@"11:00",@"11:03",@"11:06",@"11:09",@"11:12",@"11:15",@"11:18",@"11:21",@"11:24",@"11:27",@"11:30",@"11:33",@"11:36",@"11:39",@"11:42",@"11:45",@"11:48",@"11:51",@"11:54",@"11:57",@"12:00",@"12:03",@"12:06",@"12:09",@"12:12",@"12:15",@"12:18",@"12:21",@"12:24",@"12:27",@"12:30",@"12:33",@"12:36",@"12:39",@"12:42",@"12:45",@"12:48",@"12:51",@"12:54",@"12:57",@"13:00",@"13:03",@"13:06",@"13:09",@"13:12",@"13:15",@"13:18",@"13:21",@"13:24",@"13:27",@"13:30",@"13:33",@"13:36",@"13:39",@"13:42",@"13:45",@"13:48",@"13:51",@"13:54",@"13:57",@"14:00",@"14:03",@"14:06",@"14:09",@"14:12",@"14:15",@"14:18",@"14:21",@"14:24",@"14:27",@"14:30",@"14:33",@"14:36",@"14:39",@"14:45",@"14:48",@"14:51",@"14:54",@"14:57",@"15:00",@"15:03",@"15:06",@"15:09",@"15:12",@"15:15",@"15:18",@"15:21",@"15:24",@"15:27",@"15:30",@"15:33",@"15:36",@"15:39",@"15:42",@"15:45",@"15:48",@"15:51",@"15:54",@"15:57",@"16:00",@"16:03",@"16:06",@"16:09",@"16:12",@"16:15",@"16:18",@"16:21",@"16:24",@"16:27",@"16:30",@"16:33",@"16:36",@"16:39",@"16:42",@"16:45",@"16:48",@"16:51",@"16:54",@"16:57",@"17:00",@"17:03",@"17:06",@"17:09",@"17:12",@"17:15",@"17:18",@"17:21",@"17:24",@"17:27",@"17:30",@"17:33",@"17:36",@"17:39",@"17:42",@"17:45",@"17:48",@"17:51",@"17:54",@"17:57", nil];
//    NSArray *YValueArray = [NSArray arrayWithObjects:@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0",@"0.5",@"0.8",@"1.4",@"1.9",@"2.3",@"2.4",@"2.6",@"3.2",@"2.9",@"2.6",@"2.5",@"2.3",@"2.3",@"2.2",@"2.2",@"2.5",@"3",@"3.1",@"2.5",@"2.1",@"2.2",@"2.2",@"3.2",@"2.5",@"3",@"3.2",@"2.6",@"2.1",@"2.2",@"2.2",@"3.2",@"4.5",@"4.7",@"7.1",@"5.7",@"4.7",@"5.4",@"6.1",@"6.5",@"6.3",@"5.9",@"5.3",@"4.5",@"6.9",@"7.1",@"6.5",@"7.4",@"7",@"7.4",@"9.1",@"11.5",@"11.8",@"11.4",@"10.7",@"10.3",@"10.1",@"9.8",@"9",@"8.4",@"8.1",@"7.7",@"7.4",@"7",@"6.5",@"6.1",@"6.1",@"6.2",@"6.4",@"7.4",@"8.6",@"9.5",@"9.6",@"9.6",@"9.6",@"10",@"10.6",@"11.6",@"13.2",@"14.7",@"15.3",@"14.6",@"13.8",@"14.9",@"16.7",@"18.7",@"19.3",@"17.1",@"15.3",@"15",@"15.9",@"16",@"16.2",@"17.4",@"18.4",@"19.6",@"21.2",@"22.4",@"22.5",@"23",@"23.3",@"22.2",@"22.1",@"22.5",@"23.1",@"27",@"31.7",@"32.9",@"31.1",@"27.2",@"25.1",@"23.2",@"23.3",@"25.2",@"24.8",@"24.7",@"26.6",@"26",@"26",@"26.3",@"26.2",@"26.5",@"30.2",@"32.3",@"35",@"36.7",@"37.5",@"38.1",@"36.6",@"34.5",@"35.5",@"36",@"34.4",@"33.8",@"33.6",@"33.5",@"32.4",@"30.2",@"30",@"28.9",@"27.5",@"26.9",@"27.4",@"27.2",@"27.1",@"24.6",@"22",@"22.2",@"21.2",@"22.3",@"24.5",@"23.6",@"23.4",@"23.7",@"23.8",@"22.8",@"23.1",@"23.8",@"22.8",@"22.1",@"23.6",@"23.5",@"22",@"19.2",@"17.3",@"17.5",@"16",@"15",@"15.4",@"16.1",@"15.6",@"15.3",@"16",@"16.5",@"16.2",@"17.4",@"19.2",@"19.5",@"21.3",@"23.1",@"23.5",@"21",@"20.3",@"18.2",@"18.8",@"20.3",@"20.1",@"19.9",@"21.6",@"21.4",@"20.8",@"19.2",@"17.9",@"16.3",@"15.3",@"15.7",@"15.4",@"15",@"14.5",@"14.4",@"14.3",@"14",@"13.7",@"13.2",@"12.5",@"12",@"11.7",@"11.5",@"11.6",@"11.7",@"11.2",@"10.9",@"10.8",@"10.5",@"10.1",@"9.8",@"8.5",@"8.3",@"8.6",@"9.1",@"9.3",@"8.9",@"8.6",@"8.1",@"8.1",@"7.5",@"6.7",@"6.9",@"6.9",@"6.7",@"6.5",@"6.6",@"6.2",@"6.4",@"7",@"7.1",@"7",@"6.4",@"5.4",@"4.9",@"4.8",@"4.8",@"4.6",@"4.5",@"4.5",@"4.6",@"4.6",@"4.7",@"4.6", nil];
//    GJLineChartView *lineChartView = [[GJLineChartView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width,self.view.frame.size.height - 300) xTitleArray:XTitleArray yValueArray:YValueArray yMax:38.1 yMin:0.0 unit:@"kWh"];
//    [self.view addSubview:lineChartView];
    
    // type：0为饼状图，1为柱状图
    NSArray *XTitleArray = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", nil];
    NSArray *YValueArray = [NSArray arrayWithObjects:@"10",@"23",@"23",@"49",@"30",@"56",@"40",@"20",@"5",@"78",@"65",@"34", nil];
    GJChartDrawView *vc=[[GJChartDrawView alloc]initWithFrame:CGRectMake(0, 100, self.view.frame.size.width,self.view.frame.size.height - 300) type:0 yMax:78 yMin:0];
    vc.arrayPoint  = (NSMutableArray *)YValueArray;
    vc.scaleArray  = (NSMutableArray *)XTitleArray;
    vc.unitStr     = @"kwh";
    [self.view addSubview:vc];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
